﻿@page "/auth/interactive-authentication-state"
@rendermode RenderMode.InteractiveServer
@inject NavigationManager Nav
@using BasicTestApp.AuthTest

<h3>Interactive authentication state</h3>
<CascadingAuthenticationStateConsumer />

<p>
    Interactive:
    <strong id="is-interactive">@_interactive</strong>
</p>

<hr />

<a href="@Nav.GetUriWithQueryParameter("username", "YourUsername")" onclick="location.reload()">Log in</a> |
<a href="@Nav.GetUriWithQueryParameter("username", "")" onclick="location.reload()">Log out</a>

@code {
    bool _interactive = false;

    protected override void OnAfterRender(bool firstRender)
    {
        if (firstRender)
        {
            _interactive = true;
            StateHasChanged();
        }
    }
}
